import NProgress from "nprogress";
import "nprogress/nprogress.css";

NProgress.configure({
  easing: "ease",
  speed: 500,
  showSpinner: false,
  trickleSpeed: 200,
  minimum: 0.3,
});

const setProgressStyle = () => {
  const style = document.createElement("style");
  style.innerHTML = `
    #nprogress .bar {
      background: #673acb !important;W
      height: 3px !important;
    }
    #nprogress .peg {
      box-shadow: 0 0 10px #673acb, 0 0 5px #673acb !important;
    }
  `;
  document.head.appendChild(style);
};

export const initNProgress = () => {
  setProgressStyle();
  return NProgress;
};
